<%# locals: (name: nil, id_prefix: nil, label: nil, options: {}, description: nil, attributes: {}) %>

<div class="space-y-2 text-gray-900">
  <% if label %>
    <label class="block text-sm font-medium leading-6"><%= label %></label>
  <% end %>
  <fieldset>
    <div class="space-y-5">
      <% options.each_with_index do |(opt_val, opt_text, opt_classes, opt_attrs, opt_options), idx| %>
        <% opt_text = h(opt_text) if opt_text && (!opt_options || opt_options[:escape] != false) %>
        <% id = "#{id_prefix}#{name}-#{opt_val}-#{idx}" %>
        <div class="relative flex items-start <%= opt_classes %>">
          <div class="flex h-6 items-center">
            <input
              id="<%= id %>"
              name="<%= name %>"
              type="checkbox"
              value="<%= opt_val %>"
              class="h-4 w-4 rounded border-gray-300 text-orange-600 focus:ring-orange-600"
              <%== html_attrs(opt_attrs || {}) %>
            >
          </div>
          <% if opt_text %>
            <div class="ml-3 text-sm leading-6">
              <label for="<%= id %>" class="font-medium text-gray-900"><%== allow_unescaped(opt_text) %></label>
            </div>
          <% end %>
        </div>
      <% end %>
    </div>
  </fieldset>
  <% if description %>
    <p class="text-sm text-gray-500 leading-6"><%= description %></p>
  <% end %>
</div>
